package com.example.locationreport.locationreport.bean;

import com.example.locationreport.locationreport.utils.CommonUtils;
import com.example.locationreport.locationreport.utils.XmlUtils;

/**
 * author : King
 * date   : 2023/11/2218:15
 * desc   : 给Command队列发送的消息
 */
public class CommandMessageBean {

    private int taskType;
    private String imei;
    private MessageBody messageBody;
    private long createTime;

    public CommandMessageBean(int taskType){
        this.taskType = taskType ;
        this.imei = CommonUtils.getImeiID() ;
        this.createTime = System.currentTimeMillis() ;
    }

    public CommandMessageBean(int taskType , MessageBody messageBody){
        this.taskType = taskType ;
        this.imei = CommonUtils.getImeiID() ;
        this.createTime = System.currentTimeMillis() ;
        this.messageBody = messageBody ;
    }

    public int getTaskType() {
        return taskType;
    }

    public void setTaskType(int taskType) {
        this.taskType = taskType;
    }

    public String getImei() {
        return imei;
    }

    public void setImei(String imei) {
        this.imei = imei;
    }

    public MessageBody getMessageBody() {
        return messageBody;
    }

    public void setMessageBody(MessageBody messageBody) {
        this.messageBody = messageBody;
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public static class MessageBody {
        private String appVersion;
        private String ipAddress;
        private String simCode;
        private String sysVersion;
        private String sysVersionName;

        public MessageBody(){
            appVersion = CommonUtils.getVersionName();
            simCode = CommonUtils.getSimCode();

            CildXmlBean cildXmlBean = XmlUtils.readXml("/data/misc/cil/cild.xml");
            sysVersion = cildXmlBean.getSysVersion();
            sysVersionName = cildXmlBean.getSysVersionName();
        }

        public String getAppVersion() {
            return appVersion;
        }

        public void setAppVersion(String appVersion) {
            this.appVersion = appVersion;
        }

        public String getIpAddress() {
            return ipAddress;
        }

        public void setIpAddress(String ipAddress) {
            this.ipAddress = ipAddress;
        }

        public String getSimCode() {
            return simCode;
        }

        public void setSimCode(String simCode) {
            this.simCode = simCode;
        }

        public String getSysVersion() {
            return sysVersion;
        }

        public void setSysVersion(String sysVersion) {
            this.sysVersion = sysVersion;
        }

        public String getSysVersionName() {
            return sysVersionName;
        }

        public void setSysVersionName(String sysVersionName) {
            this.sysVersionName = sysVersionName;
        }
    }
}
